package io.renren.modules.substation.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.substation.entity.TSampCameraDataInfoEntity;
import io.renren.modules.substation.service.TSampCameraDataInfoService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 可见光采样数据信息表
 *
 * @author yzx
 * @email sunlightcs@gmail.com
 * @date 2020-07-02 16:05:00
 */
@RestController
@RequestMapping("substation/tsampcameradatainfo")
public class TSampCameraDataInfoController {
    @Autowired
    private TSampCameraDataInfoService tSampCameraDataInfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("substation:tsampcameradatainfo:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tSampCameraDataInfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("substation:tsampcameradatainfo:info")
    public R info(@PathVariable("id") Long id){
		TSampCameraDataInfoEntity tSampCameraDataInfo = tSampCameraDataInfoService.getById(id);

        return R.ok().put("tSampCameraDataInfo", tSampCameraDataInfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("substation:tsampcameradatainfo:save")
    public R save(@RequestBody TSampCameraDataInfoEntity tSampCameraDataInfo){
		tSampCameraDataInfoService.save(tSampCameraDataInfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("substation:tsampcameradatainfo:update")
    public R update(@RequestBody TSampCameraDataInfoEntity tSampCameraDataInfo){
		tSampCameraDataInfoService.updateById(tSampCameraDataInfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("substation:tsampcameradatainfo:delete")
    public R delete(@RequestBody Long[] ids){
		tSampCameraDataInfoService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
